import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:leader_help/page/login/main/widgets/account_pwd.dart';
import 'package:leader_help/utils/component/component.dart';
import 'package:leader_help/utils/util.dart';

import 'index.dart';
import 'widgets/widgets.dart';

class LoginPage extends GetView<LoginController> {
  const LoginPage({Key? key}) : super(key: key);

  // 内容页
  Widget _buildView() {
    return ListView(
      padding: EdgeInsets.symmetric(horizontal: 10.r),
      children: const [
        LoginTitleView(),
        LoginInputView(),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () {
        controller.mainCtrl.state.isShowFloat = true;
        return Future.value(true);
      },
      child: GetBuilder<LoginController>(
        builder: (_) {
          return Scaffold(
            appBar: presentAppBar(
              context,
              backgroundColor: ColorsUtil.bg,
              callback: () {
                controller.mainCtrl.state.isShowFloat = true;
              },
            ),
            body: _buildView(),
            bottomNavigationBar: SafeArea(
              child: SizedBox(
                height: 80.h,
                child: Column(
                  children: [
                    Container(
                      padding: EdgeInsets.symmetric(horizontal: 40.w),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: ['帮助', '隐私', '条款']
                            .asMap()
                            .map(
                              (key, value) => MapEntry(
                                key,
                                InkWell(
                                  onTap: () => controller.handleTap(key),
                                  child: Text(
                                    value,
                                    style: pfMediumStyle(
                                        color: ColorsUtil.subTitle,
                                        fontSize: 15.sp),
                                  ),
                                ),
                              ),
                            )
                            .values
                            .toList(),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.symmetric(vertical: 15.r),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text(
                            'copyright',
                            style: pfMediumStyle(
                                color: ColorsUtil.subTitle, fontSize: 15.sp),
                          ),
                          Container(
                            height: 12.sp,
                            width: 12.sp,
                            margin: EdgeInsets.symmetric(horizontal: 3.r),
                            alignment: Alignment.center,
                            decoration: BoxDecoration(
                              border: Border.all(color: ColorsUtil.subTitle),
                              borderRadius: BorderRadius.circular(6.sp),
                            ),
                            child: Text(
                              'C',
                              style: pfMediumStyle(
                                  color: ColorsUtil.subTitle, fontSize: 8.sp),
                            ),
                          ),
                          Text(
                            '2021 启明星数字政府研究中心',
                            style: pfMediumStyle(
                                color: ColorsUtil.subTitle, fontSize: 15.sp),
                          )
                        ],
                      ),
                    )
                  ],
                ),
              ),
            ),
          );
        },
      ),
    );
  }
}
